class Solution {
public:
    string longestCommonPrefix(vector<string>& strs) 
    {
        //输入为[]时显示reference binding to null pointer of type 'struct value_type' (stl_vector.h)，不知道是什么原因
        if(strs[0].size() && strs[1].size() && strs[2].size() == 0)
            return "";
        
        string s = "";

        for(int i = 0; i < strs[0].size() && strs[1].size() && strs[2].size(); i++)
        {
            if(strs[0][i] == strs[1][i] && strs[0][i] == strs[2][i])
                s += strs[0][i];
        }
        return s;
    }
};